<!DOCTYPE html>
<html>
<head>
    <title>我的点赞列表</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/userTravels.css"/>
    <link href="/css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {
            var currentInput = $("#currentPage");
            var Pages = 1;
            var travelArr=[];
            var params = getParams();
            var user = JSON.parse(sessionStorage.getItem('user'));
            $.ajax({
                url:"/messages/reads",
                data:{
                    authorId:user.id,
                    type:params.type
                },
                type:"PUT",
            });
            function query() {
                var currentPage = currentInput.val();
                $.get("/messages/" + user.id + "/unRead", {
                    currentPage: currentPage,
                    state: 0,
                    type: params.type
                }, function (data) {
                    $.merge(travelArr, data.list);
                    if(data.pages == 0){
                        $(".praiseMsg").html("还没有人给你点赞哦!")
                    }else {
                        $(".praiseMsg").renderValues({list:travelArr}, {
                            getHref: getHref
                        });
                    }
                    Pages = data.pages;
                });
                currentInput.val(parseInt(currentPage) + 1);
            }
            if(params.type){
                query();
            }
            $(window).scroll(function () {
                if($(document).scrollTop()+ $(window).height()>=$(document).height()){
                    if(currentInput.val()<=Pages){
                        query();
                    }else{
                        $(document).dialog({
                            type:"notice",
                            infoText:"已经到底啦",
                            autoClose:1000
                        })
                    }
                }
            });

        });
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="/mine/message.html">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>我的点赞列表</span>
        </div>
        <div class="col"></div>
    </div>
</div>

<input type="hidden" name="currentPage" id="currentPage" value="1"/>
<div class="container">
    <hr>
    <div class="praiseMsg">
        <div render-loop="list">
            <div>
                <div class="row info" style="margin:30px;">
                    <div class="col-2" style="margin-right: 20px;">
                        <a data-href="/userProfiles.html?id=" render-key="list.sender.id" render-fun="getHref">
                            <div class="row">
                                <img class="rounded-circle" render-src="list.sender.headImgUrl" style="width: 30px;height: 30px">
                            </div>
                            <div class="row">
                                <small style="width: auto" render-html="list.sender.nickName"></small>
                            </div>
                        </a>
                    </div>
                    <div class="col-9">
                        <a  data-href="/travelContent.html?id=" render-key="list.travel.id" render-fun="getHref" >
                            <div class="aui-layNews-time" render-html="list.date"></div>
                            <div>
                                <p id="content" render-html="list.content" style="text-align: center" ></p>
                            </div>
                        </a>
                    </div>
                </div>
                <hr style="background-color:beige"/>
            </div>
        </div>
    </div>
</div>
<hr>
</div>
</body>
</html>